package com.itfreer.bpm.option.para;

import java.util.ArrayList;
import java.util.List;
/**
 * 下一个节点信息
 * @author gj
 *
 */
public class NextTaskInfo {
	
	/**
	 * 获取下一个环节的名称
	 * @return
	 */
	public String getNextTaskName() {
		String nextTaskName="结束";
		if(this.getNextTask().size()==1) {
			nextTaskName=this.getNextTask().get(0).getTaskName();
		}else if(this.getNextTask().size()>1){
			String head="";
			if(NextTaskType.ExclusiveTask.equals(this.getNextTaskType())) {
				nextTaskName="";
				for(TaskInfo itask:this.getNextTask()) {
					nextTaskName=nextTaskName+"或"+itask.getTaskName();
				}
				nextTaskName=nextTaskName.substring(1, nextTaskName.length());
			}else {
				nextTaskName="";
				for(TaskInfo itask:this.getNextTask()) {
					nextTaskName=nextTaskName+","+itask.getTaskName();
				}
				nextTaskName=nextTaskName.substring(1, nextTaskName.length());
				nextTaskName="会签（"+nextTaskName+")";
			}
		}
		return nextTaskName;
	}
	/**
	 * 下一个节点类型
	 */
	private NextTaskType nextTaskType;
	/**
	 * 下一个节点
	 */
	private List<TaskInfo> nextTask=new ArrayList<>();
	
	public NextTaskType getNextTaskType() {
		return nextTaskType;
	}
	public void setNextTaskType(NextTaskType nextTaskType) {
		this.nextTaskType = nextTaskType;
	}
	public List<TaskInfo> getNextTask() {
		return nextTask;
	}
	public void setNextTask(List<TaskInfo> nextTask) {
		this.nextTask = nextTask;
	}
}
